﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PurchasesMate.aspx.cs" Inherits="Automobile.service.UI.PurchasesMate" %>

<!DOCTYPE html>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="lib/html5.js"></script>
    <script type="text/javascript" src="lib/respond.min.js"></script>
    <script type="text/javascript" src="lib/PIE_IE678.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="css/H-ui.admin.css" />
    <link href="lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="lib/icheck/icheck.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>角色列表</title>
</head>
<body>
    <!--top 导航-->
    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 系统管理 <span class="c-gray en">&gt;</span> 员工管理 <a class="btn btn-success radius r" style="line-height: 1.6em; margin-top: 3px" href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a></nav>

    <div class="page-container">
        <div class="mt-20">
            <table class="table table-border table-bordered table-bg">
            <tr class="text-c"><td>供货商：<asp:Label ID="Label1" runat="server"></asp:Label></td><td>仓库：<asp:Label ID="Label2" runat="server"></asp:Label></td><td>下单人：<asp:Label ID="Label3" runat="server"></asp:Label></td></tr>
        </table>
        </div>
        <div class="mt-20">
            <table class="table table-border table-bordered table-bg">
                <thead>
                    <tr class="text-c">
                        <th width="40">订单编号</th>
                        <th width="150">商品名称</th>
                        <th width="90">商品数量</th>
                        <th width="150">商品价格</th>
                        <th width="90">商品小计</th>
                        
                    </tr>
                </thead>
                <tbody id="mybody">
                </tbody>
            </table>
        </div>
        <div>
            
            <button id="button1" style="margin-left:100px; margin-top:20px;">审核</button>
            <span id="span1" style="float:right; margin-right:30px; padding-right:50px;"></span>
        </div>
    </div>
    <script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="lib/layer/1.9.3/layer.js"></script>
    <script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
    <script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
    <script type="text/javascript" src="js/H-ui.js"></script>
    <script type="text/javascript" src="js/H-ui.admin.js"></script>
    <script type="text/javascript">
        $(function () {
            var s = location.search;
            var d = s.substr(s.lastIndexOf("=") + 1);
            //获取商品信息
            $.ajax({
                type: 'post',
                url: 'Hander/PurchasesMate.ashx',
                data: {
                    id:d
                },
                success: function (data) {
                    var data1 = eval("(" + data + ")");
                    //var data1 =$.parseJSON(data);
                    for (var i in data1) {
                        var str = '<tr class="text-c"><td>' + data1[i].PurchaseMate_Id + '</td><td>' + data1[i].Product_Name + '</td><td>' + data1[i].PurchaseMate_Num + '</td><td>' + data1[i].PurchaseMate_Price + '元</td><td><span id="sum1" name="sum">' + data1[i].SumMoney + '</span>元</td></tr>';
                        $("#mybody").append(str);
                    }
                    //总金额
                    var e = 0;
                    $("[name='sum']").each(function () {
                        e += parseFloat($(this).html());
                    })

                    $("#span1").html("小计："+e+"元");
                }    
            })
           
            //获取供货商，仓库，下单人信息
            $.ajax({
                type: 'post',
                url: 'Hander/PurchaseByID.ashx',
                data: {
                    id:d
                },
                success: function (data) {
                    var data1 = eval("(" + data + ")");
                    //var data1 =$.parseJSON(data);
                    $("#Label1").html(data1[0].Supplier_Name);
                    $("#Label2").html(data1[0].WareHose_Name);
                    $("#Label3").html(data1[0].Employee_Name);
                }
            })
            //审核入库
            $("#button1").click(function () {
                alert(d);
                $.ajax({
                    type: 'post',
                    url: 'Hander/Proc_Ruku.ashx',
                    data: {
                        id: d
                    },
                    success: function (data) {
                        if (data > 0) {
                            alert("审核成功！");
                        }
                    },
                    error: function () {
                        alert("服务器忙");
                    }
                })
            })
            
        })
        
    </script>
</body>
</html>

